<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr=[34,1,45,67,35,466,5,25,134,6]
        function fn(arr){
            if(arr.length<2){
                return arr;
            }

            var left=[],right=[];
            var middleIndex=parseInt(arr.length/2);
            var middleValue=arr.splice(middleIndex,1)[0];

            for(var i=0;i<arr.length;i++){
                if(arr[i]>middleValue){
                    right.push(arr[i]);
                }else{
                    left.push(arr[i]);
                }
            }
            return fn(left).concat(middleValue,fn(right));
        }
        var res=fn(arr);
        console.log(res);
    </script>
</body>
</html>